package Util
{
	import datastructure.Vertex;
	
	import flash.display.Sprite;

	public class Tools
	{
		public function Tools()
		{
			
		}
		
		
		/**
		 * 移出目标容器targetSprite上的所有孩子
		 * @param targetSprite
		 * 
		 */		
		public static function removeAllChild(targetSprite:Sprite):void
		{
			for(var i:int = targetSprite.numChildren - 1; i>=0; i--)
			{
				targetSprite.removeChildAt(0);
			}
		}
		
		
		/**
		 * 设置顶点的位置 
		 * @param vertexArray	顶点的数组
		 * @param positions	位置的数组
		 * 
		 */	
		public static function setVertexPosition(vertexArray:Array,positions:Array):void
		{
			for(var i:int = 0;i < vertexArray.length;i++)
			{
				(vertexArray[i] as Vertex).xCoordinate = positions[i].x;
				(vertexArray[i] as Vertex).yCoordinate = positions[i].y;
			}
		}
		
		
		
	}
}